<template>
  <el-container>
    <el-header>Header</el-header>
    <el-container>
      <el-aside width="200px">
        <!-- @select激活菜单回调 回获取到点击的index -->
        <el-menu :default-openeds="['1', '3']" @select="menuClick">
          <el-submenu index="1">
            <template slot="title"
              ><i class="el-icon-location"></i>导航一</template
            >
            <el-menu-item index="test1">选项1</el-menu-item>
            <el-menu-item index="test2">选项2</el-menu-item>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-main>
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: 'Home',
  methods: {
    // index 点击了那个
    menuClick(index) {
      this.$router.push(index)
    },
  },
}
</script>

<style></style>
